#define _CRT_SECURE_NO_WARNINGS 1
#include"string.h"

namespace hds
{
	void test01()
	{
		hds::string str("hello world");
		cout << str.c_str() << endl;

		cout << str.size() << endl;

		str.push_back('!');
		cout << str.c_str() << endl;
	}

	void test02()
	{
		hds::string str("hello");
		str.append("world");
		cout << str.c_str() << endl;
	}

	void test03()
	{
		hds::string str("hello");
		str += "world";
		cout << str.c_str() << endl;
	}

	void test04()
	{
		hds::string str("hello world");
		str.insert(0, 'x');
		str.insert(7, 'y');
		str.insert(13, '!');
		cout << str.c_str() << endl;
	}

	void test05()
	{
		hds::string str("hello world");
		str.insert(0, "***");
		str.insert(9, "hds");
		str.insert(17, "!!!");
		cout << str.c_str() << endl;
	}

	void test06()
	{
		hds::string s1("hello world");
		s1.erase(5, 10);
		cout << s1.c_str() << endl;
		hds::string s2("hello world");
		s2.erase(5);
		cout << s2.c_str() << endl;
		hds::string s3("hello world");
		s3.erase(6, 3);
		cout << s3.c_str() << endl;
	}

	void test07()
	{
		hds::string s1("hello world");
		cout << s1.find('o', 0) << endl;
		cout << s1.find("wor", 0) << endl;

		string tmp = s1.substr(6, 10);
		cout << tmp.c_str() << endl;
	}

	void test08()
	{
		hds::string s1("hello world");
		hds::string s2("hello world");
		cout << (s1 <= s2) << endl;
	}

	void test09()
	{
		string s1("hello world");
		string s2("hello world");
		cout << s1 << s2 << endl;

		string s3;
		cin >> s3;
		cout << s3 << endl;
	}

	void test()
	{
		string s1("hello world");
		string s2(s1);
		cout << s1 << endl;
		cout << s2 << endl;

		string s3 ("hds");
		s3 = s1;
		cout << s3 << endl;
	}
}
int main()
{
	//hds::test01();
	//hds::test02();
	//hds::test03();
	//hds::test04();
	//hds::test05();
	//hds::test06();
	hds::test();
	return 0;
}